LeetCode 206:

Brute force approach: stack-based solution (time O(n) + space O(n))

Three pointer approach (optimal solution):
prev	cur  next
null <-	1  2 -> 3 -> null

3 -> 2 -> 1 -> null

----------------------------------------------------------------------
Doubly linked list

DNode: DNode<T> previous, T element, DNode<T> next
Special nodes: header and trailer

header:

previous = null, element = null, next = first DNode in the doubly linked list

trailer:
previous = last DNode in the doubly linked list, element = null, next = null

Position<T>: T getElement()

DNode implements Position

DList<T>: 
int size()
boolean isEmpty()

DNode<T> first()  throws EmptyListException 
---> The position of the first element in the doubly linked list
DNode<T> last() throws EmptyListException

DNode<T> next(DNode<T> d) throws BoundaryViolationException, InvalidPositionException
DNode<T> prev(DNode<T> d) throws BoundaryViolationException, InvalidPositionException


T remove(DNode<T> d) throws InvalidPositionException
T replace(DNode<T> d, T e) throws InvalidPositionException

DNode<T> insertFirst(T e) 
DNode<T> insertLast(T e)

DNode<T> insertBefore(DNode<T> d, T e) throws InvalidPositionException
DNode<T> insertAfter(DNode<T> d, T e) throws InvalidPositionException

header <--> 0 <--> 1 <--> 2 <--> 3 <--> trailer


newDNode --- 0
|

header <---> 0











 